const cashDao = require("../dao/cashDao");

exports.getList = async (req, res) => {
  try {
    const list = await cashDao.getAll();
    res.json(list);
  } catch (err) {
    console.error(err);
    res.status(500).json({ code: 500, message: "获取提现记录失败" });
  }
};

exports.updateStatus = async (req, res) => {
  try {
    const { id } = req.params;
    await cashDao.updateStatus(id);
    const updated = await cashDao.getById(id);
    res.json({ code: 200, message: "状态更新成功", data: updated });
  } catch (err) {
    console.error(err);
    res.status(500).json({ code: 500, message: "更新状态失败" });
  }
};
